#ifndef STRINGSEGMENT_H_
#define STRINGSEGMENT_H_

#include "Vector2D.h"
#include "Object.h"

class StringSegment
{	
	
	
	Vector2D acceleration;
	
	
	float mass;
	
	
	float dampingConstant;
	float currentLength;
	
	public:
	Vector2D velocity;
	float originalSpringConstant;
	float springConstant;
	float restLength;
	void ResetDampingConstant();
	void SetSpringConstant(float springConstant);
	void SetDampingConstant(float mass);
	Vector2D totalForce;
	Vector2D endPoint;
	StringSegment(Vector2D endPoint, float mass, float restLength, float springConstant);
	~StringSegment();
	void AddForce(Vector2D force);
	
	void Think(double elapsedTime);
	void AddGravitationalForce();
	Vector2D CalculateStringForce(Vector2D * anchor);
	Vector2D CalculateStringForce(Vector2D * anchor, Vector2D anchorVelocity);
	Vector2D CalculateStringForce(Vector2D * anchor, Object * object, Vector2D * grabPoint);
	Vector2D CalculateStringForce(Vector2D * anchor, Vector2D anchorVelocity, Object * object, Vector2D * grabPoint);
	Vector2D CalculateGravitationalForce(Vector2D * anchor);
	Vector2D CalculateGravitationalForce(Vector2D * anchor, Object * weight);
};
#endif /*STRINGSEGMENT_H_*/

